package com.example.demo.leetcode100题;

import com.example.demo.StopWatchTemplate;

/**
 * @author：zzc
 * @date: 2022/9/4
 */
public class 翻转二叉树 {

    public static void main(String[] args) {

        System.out.println(StopWatchTemplate.doSupplier(() -> invertTree(new TreeNode())));
    }

    private static TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }

        invertTree(root.left);
        invertTree(root.right);
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        return root;
    }

}
